	<?php
	class Monster{
		public $monster_name;
		public $monster_att;
		public $monster_hp;
		
		public function __construct($name,$att,$hp){
			$this->monster_name=$name;
			$this->monster_att=$att;
			$this->monster_hp=$hp;
		}
		
		public function attack(){
			echo $this->monster_name.'展开攻击<br>';
			echo '当前生命值是：'.$this->monster_hp;
			echo '<br>';
			echo "攻击力是：".$this->monster_att;
			echo "<br>";
		}
		
		public function move(){
			echo $this->name.'开始移动<hr>';
		}
	}
	
	class Snake extends Monster{
		public function healing(){
			if($this->monster_hp<10){
				$this->monster_hp+=20;
				echo "使用大蛇补血术.....<br>";
				echo "回复20点生命值，当前生命值是：".$this->monster_hp;
				echo "<br>";
			}
		}
		public function move(){
			echo "我是".$this->monster_name.",我走S型路线<hr>";
		}
	}
	
	class Centipede extends Monster{
		public function move(){
			echo "我是".$this->monster_name.",御风飞行<hr>";
		}
	}
	
	class Test{
		public function __construct($monster1,$monster2){
			$monster1->attack();
			$monster1->healing();
			$monster1->move();
			
			$monster2->attack();
			$monster2->move();
		}
	}
	
	$s1=new Snake('蛇妖',20,5);
	$c1=new Centipede('蜈蚣怪',15,60);
	
	$s1->attack();
	$s1->healing();
	$s1->move();
	$c1->attack();
	$c1->move();
	echo "<pre>";
	var_dump($s1);
	var_dump($c1);

	new Test(new Snake('蛇妖',20,5),new Centipede('蜈蚣怪',15,60));
	
?>